﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using PHMEE.Admin.Controllers;
using Volo.Abp.Application.Dtos;

namespace PHMEE.Admin.HttpApi.Controllers.BaseInfo.Fleets
{
    /// <summary>
    /// 船队管理🚢🌞🌛✨
    /// </summary>
    [Route("phmeeadmin/api/fleet")]
    public class FleetController : PHMEEAdminController
    {
        private readonly IFleetAppService fleetAppService;

        /// <summary>
        /// 构造器注入
        /// </summary>
        /// <param name="fleetAppService"></param>
        public FleetController(IFleetAppService fleetAppService)
        {
            this.fleetAppService = fleetAppService;
        }

        /// <summary>
        /// 创建船队
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("CreateFleet")]
        public async Task<Guid> CreateFleet(FleetCreateDto input)
        {
            return await fleetAppService.CreateFleetAsync(input);
        }

        /// <summary>
        /// 更新船队
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        [Route("UpdateFleet")]
        public async Task UpdateFleet(FleetUpdateDto input)
        {
            await fleetAppService.UpdateFleetAsync(input);
        }

        /// <summary>
        /// 船队详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetFleetById")]
        public async Task<FleetDto> GetFleetById(Guid id)
        {
            return await fleetAppService.GetFleetByIdAsync(id);
        }

        /// <summary>
        /// 删除船队
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        [Route("DeleteFleet")]
        public async Task DeleteFleet(Guid id)
        {
            await fleetAppService.DeleteFleetAsync(id);
        }

        /// <summary>
        /// 船队分页集合
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetPagedFleets")]
        public async Task<PagedResultDto<FleetDto>> GetPagedFleets(FleetListDto input)
        {
            return await fleetAppService.GetPagedFleetsAsync(input);
        }
    }
}
